<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>smooth scroll</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/windowScroll.js"></script>
    <style>
        html,body{
            height: 100%;
            margin: 0;
            font-family: "Microsoft Yahei", "幼圆", Tahoma, 'simsun';
        }
        nav{
            position: fixed;
            top: 0;
            left: 0;
            z-index: 999;
            height: 100%;
            background: #dbdbdb;
        }
        nav div.nav-container{
            margin: 50% auto;
        }
        nav div.nav-container .nav-item{
            margin: 0 0 20px 0;
        }
        nav a{
            padding: 10px 20px;
        }
        nav a.active{
            background: #FFFFFF;
        }
        section{
            height: 100%;
            position: relative;
            overflow: hidden;
        }
        section:nth-child(1){
            background-color: red
        }
        section:nth-child(2){
            background-color: orange
        }
        section:nth-child(3){
            background-color: yellow;
        }
        section:nth-child(4){
            background-color: green;
        }
        section:nth-child(5){
            background-color: greenyellow;
        }
        h1{
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;
            color: #FFFFFF;
            text-align: center;
            height: 50px;
            font-size: 4em;
            -webkit-transition: all 0.5s ease;
            transition: all 0.5s ease;
        }
        h1.bigger{
            transform: scale(1.5);
        }
    </style>
</head>
<body>
<nav>
    <div class="nav-container">
        <div class="nav-item"><a href="#box1" class="smooth-scroll">box1</a></div>
        <div class="nav-item"><a href="#box2" class="smooth-scroll">box2</a></div>
        <div class="nav-item"><a href="#box3" class="smooth-scroll">box3</a></div>
        <div class="nav-item"><a href="#box4" class="smooth-scroll">box4</a></div>
        <div class="nav-item"><a href="#box5" class="smooth-scroll">box5</a></div>
    </div>
</nav>
<div class="container">
    <section class="smooth-target" id="box1"><h1>BOX 1</h1></section>
    <section class="smooth-target" id="box2"><h1>BOX 2</h1></section>
    <section class="smooth-target" id="box3"><h1>BOX 3</h1></section>
    <section class="smooth-target" id="box4"><h1>BOX 4</h1></section>
    <section class="smooth-target" id="box5"><h1>BOX 5</h1></section>
</div>
</body>
</html>